/**
 * 设置预警值
 */
function setWarning() {
    DGG.loading();
    $.post(sysInfo.basePath + "/zs/warning_configure/set_warning_page.do", {}, function (result) {
        var index = dgg.Open({
            type: 1,
            title: '库容预警设置',
            btn: ["确定", "取消"],
            content: result,
            area: '500px',
            yes: function () {
                if (!$('[name="storageWarning"]').attr("disabled")) {
                    if (!numCheck('[name="storageWarning"]', 8, true)) return false;
                    $.ajax({
                        type: "post",
                        url: sysInfo.basePath + "/zs/warning_configure/update_single_warning.do",
                        data: {
                            warningType: $("[name='generalType']").val(),
                            warningName: "STORAGE_WARNING",
                            warningValue: $("[name='storageWarning']").val()
                        },
                        dataType: "json",
                        success: function (result) {
                            if (result.code == 0) {
                                layer.close(index);
                                DGG.Succeed('保存成功!');
                                search('#myTable', 'reload');
                            } else {
                                DGG.Errors(result.msg);
                            }
                        }
                    });
                    DGG.loading('close');
                } else {
                    DGG.Errors("您所在的组织机构没有所在事业部，不能进行设置");
                    layer.close(index);
                }

            }, end: function () {
                layer.closeAll("tips");
                DGG.loading('close');
            }
        });
    }, 'html');
}


/**
 * 设置预警值
 */
function setZZWarning() {
    DGG.loading();
    $.post(sysInfo.basePath + "/zs/warning_configure/set_zz_warning_page.do", {}, function (result) {
        var index = dgg.Open({
            type: 1,
            title: '库容预警设置',
            btn: ["确定", "取消"],
            content: result,
            area: ['40%', '60%'],
            yes: function () {
                if (!numCheck('[name="storageWarning"]', 8, true)) return false;
                $.ajax({
                    type: "post",
                    url: sysInfo.basePath + "/zs/warning_configure/update_single_warning.do",
                    data: {
                        warningType: $("[name='generalType']").val(),
                        warningName: "STORAGE_WARNING",
                        warningValue: $("[name='storageWarning']").val()
                    },
                    dataType: "json",
                    success: function (result) {
                        if (result.code == 0) {
                            layer.close(index);
                            DGG.Succeed('保存成功!');
                            search('#myTable', 'reload');
                        } else {
                            DGG.Errors(result.msg);
                        }
                    }
                });
                DGG.loading('close');
            }, end: function () {
                layer.closeAll("tips");
                DGG.loading('close');
            }
        });
    }, 'html');
}